import utility
import mail
import time
sendTime = 0
map = {"abyss_return.png":"小助手回城","death.png":"挂了","disconnected.png":"掉线了","rom_return.png":"rom回城"}
def checkStates():
    global sendTime
    (point,fileName) = utility.findOneFromDir("./images/errorStates/",0.9)
    if point != None:
        print(map[fileName])
        currentTime = time.time()
        if currentTime - sendTime >1800:
            mail.sendMsg(map[fileName])
            sendTime = currentTime
        else:
            print("发送邮件间隔未到，不发送邮件")
        return 1 #异常
    return 0 #正常
